package com.enation.app.javashop.api.client;


import com.enation.app.javashop.model.shop.dos.ShopLogisticsSetting;
import com.enation.app.javashop.service.shop.ShopLogisticsCompanyManager;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * 店铺物流
 *
 * @author zh
 * @version v7.0
 * @date 19/12/02 下午8:10
 * @since v7.0
 */
@Api(description = "会员收藏商品api")
@RestController
@RequestMapping("/client/shops/logistics-company")
@Validated
@ApiIgnore
public class ShopLogisticsCompanyClientController {

    @Autowired
    private ShopLogisticsCompanyManager shopLogisticsCompanyManager;

    @RequestMapping(value = "/{logistics_id}", method = RequestMethod.GET)
    public List queryListByLogisticsId(@PathVariable("logistics_id") Long logisticsId){

        return shopLogisticsCompanyManager.queryListByLogisticsId(logisticsId);
    }

    /**
     * 删除绑定某物流公司的所有店铺
     * @param logisticsId
     */
    @RequestMapping(value = "/{logistics_id}", method = RequestMethod.DELETE)
    public void deleteByLogisticsId(@PathVariable("logistics_id")Long logisticsId){

        shopLogisticsCompanyManager.deleteByLogisticsId(logisticsId);
    }

    @RequestMapping(value = "/{logistics_id}/{seller_id}", method = RequestMethod.GET)
    public ShopLogisticsSetting query(@PathVariable("logistics_id")Long logisticsId, @PathVariable("seller_id")Long sellerId){

        return shopLogisticsCompanyManager.query(logisticsId,sellerId);
    }



}
